#ifndef MEDIAMODEL
#define MEDIAMODEL

#include <QAbstractListModel>

class Media{
public:
    Media(const QString &name, const QString &url);
    QString name() const;
    QString url() const;
private:
    QString m_name;
    QString m_url;
};

class MediaModel: public QAbstractListModel{
    Q_OBJECT
public:
    enum MediaRoles {
        NameRole = Qt::UserRole + 1,
        UrlRole
    };

    MediaModel(QObject *parent = 0);

    void addMedia(const Media &media);

    int rowCount(const QModelIndex & parent = QModelIndex()) const;

    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;

    Q_INVOKABLE void importFolder(QString folder);

    Q_INVOKABLE QString getUrl(int index) const;
    Q_INVOKABLE QString getName(int index) const;
protected:
    QHash<int, QByteArray> roleNames() const;
private:
    QList<Media> m_medias;
};

#endif // MEDIAMODEL

